package hu.vaes_dot_hrak.szoftlab4;

public class GameController {
	private final long STEPTIME = 10;
	private final long ANT_FREQUENCY = 30;
	private final long SPINYANTEATER_FREQUENCY = 300;

	public GameController() {
		Player player = new Player(5, 3, 5, 3, 10);
	}

	public void runGame() {
		Map map = new Map();
		long lastStepTime = System.currentTimeMillis();
		long currentStepTime = System.currentTimeMillis();
		long lastSpinyAntEaterTime = System.currentTimeMillis();
		long lastAntTime = System.currentTimeMillis();

		while (map.getSumFoodsQuantity() > 0) {
			currentStepTime = System.currentTimeMillis();
			if (currentStepTime - lastStepTime > STEPTIME) {
				boolean goSpinyAntEater = false;
				boolean goAnt = false;
				if (currentStepTime - lastSpinyAntEaterTime > SPINYANTEATER_FREQUENCY) {
					goSpinyAntEater = true;
					lastSpinyAntEaterTime = currentStepTime;
				}
				if (currentStepTime - lastAntTime > ANT_FREQUENCY) {
					goAnt = true;
					lastAntTime = currentStepTime;
				}
				lastStepTime = currentStepTime;
				map.timeStep(goSpinyAntEater, goAnt);
			}
		}
	}
}
